#include<iostream>
#include<unistd.h>
#include<signal.h>
#include<sys/wait.h>
#include<sys/types.h>
void myhandler(int signo )
{
    std::cout<<"process get a signal: "<<signo<<std::endl;
}

int main()
{
    signal(2,myhandler);

    int cnt=0;
    while(true)
    {
       std::cout<<"I am process,pid: "<<getpid()<<std::endl;
        cnt++;
        sleep(2);
        if(cnt%2==0)
        {
            raise(2);
            //abort();
        }
    }
    return 0;
}